package com.zxl.demo.factory;

import com.zxl.demo.annotation.CustomAnnotation;
import com.zxl.demo.domain.Car;
import org.springframework.stereotype.Component;

/**
 * 汽车工厂
 */
@Component("carFactory")
public class CarFactory {

    /**
     * @param carNo
     * @param num
     * @param d
     * @param flag
     * @param car
     */
    @CustomAnnotation(itfName = "接口1",logIdPropertity = "name")
    public Car invoke(String carNo, int num, double d, boolean flag, Car car){
//        try {
//            int i=1/0; // 模拟异常用
//        }catch (Exception e){
//            throw  e;
//        }
//        throw new Exception("模拟异常");
        return car;
    }

    /**
     * 销毁汽车
     */
    @CustomAnnotation(itfName = "接口2")
    public String destory(Car car) {
        return "success";
    }
}
